<?php
//王晓梦
declare (strict_types=1);

namespace app\backend\validate;

use think\Validate;

class SupplyValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require',
        'cate_id' => 'require',
        'image' => 'require',
        'title' => 'require',
        'price' => 'require',
        'turnover' => 'require',
        'purchasing' => 'require',
        'address' => 'require',
        'logistics' => 'require',
        'guige' => 'require',
        'see' => 'require',
        'comment' => 'require',
        'varieties' => 'require',
        'weight' => 'require',
        'type' => 'require',
        'environment' => 'require',
        'purpose' => 'require',
        'content' => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => 'id不能为空',
        'cate_id.require' => '请输入所属分类',
        'image.require' => '请上传图片',
        'title.require' => '请输入标题',
        'price.require' => '请输入价格',
        'turnover.require' => '请输入成交额',
        'purchasing.require' => '请输入采购榜',
        'address.require' => '请输入发货地址',
        'logistics.require' => '请输入物流费用',
        'guige.require' => '请输入规格选择',
        'see.require' => '请输入浏览量',
        'comment.require' => '请输入评论量',
        'varieties.require' => '请输入所属品种',
        'weight.require' => '请输入重量',
        'type.require' => '请输入所属类型',
        'environment.require' => '请输入生长环境',
        'purpose.require' => '请输入用途',
        'content.require' => '请输入商品详情',

    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'save' => ['content','purpose','weight','environment','type','varieties','comment','cate_id', 'see','image', 'title','price','turnover','purchasing','address','logistics','guige'],
        'update' => ['id','purpose','content','weight','environment','type','varieties','comment','cate_id', 'see','image', 'title','price','turnover','purchasing','address','logistics','guige']
    ];
}
